<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">
<h:head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>Untitled Document</title>
	<link rel="stylesheet" type="text/css" href="css/main.css" />
	<link rel="stylesheet" type="text/css" href="css/meniu.css" />
	<link rel="stylesheet" type="text/css" href="css/style.css" />

</h:head>
<h:body>

	<ui:include src="header.xhtml" />

	<h:panelGroup layout="block" id="content">

		<ui:include src="leftMenu.xhtml" />

		<h:panelGroup layout="block" id="contenRight">

			<h:panelGroup layout="block" id="header" style="margin-top: 20px;">
				<ul>
					<li id="selected"><a>Survey Answers</a></li>
				</ul>
			</h:panelGroup>

			<h:panelGroup layout="block" id="contentTab">
				<h:form styleClass="answerPanel">
					<h:outputFormat value="#{surveyBeanAnswers.surveyDTO.title}"
						styleClass="surveyAnswerTitle" />
					<br />
					<br />
					<h:outputFormat value="Category :" styleClass="surveyAnswer" />
					<h:outputFormat value="#{surveyBeanAnswers.category.name}"
						styleClass="surveyAnswer2" />
					<br />
					<h:outputFormat value="Subcategory :" styleClass="surveyAnswer" />
					<h:outputFormat value="#{surveyBeanAnswers.subcategory.name}"
						styleClass="surveyAnswer2" />
					<br />
					<br />
					<h:outputFormat value="Survey Description: "
						styleClass="surveyAnswer" />
					<br />
					<h:outputFormat value="#{surveyBeanAnswers.surveyDTO.description}"
						styleClass="surveyAnswer2" />
					<br />
					<br />
					<h:outputFormat value="Start Date : " styleClass="surveyAnswer" />
					<h:outputFormat value="#{surveyBeanAnswers.surveyDTO.startDate}"
						styleClass="surveyAnswer2">
						<f:convertDateTime pattern="yyyy-MM-dd" />
					</h:outputFormat>
					<br />
					<br />
					<h:outputFormat value="End Date : " styleClass="surveyAnswer" />
					<h:outputFormat value="#{surveyBeanAnswers.surveyDTO.endDate}"
						styleClass="surveyAnswer2">
						<f:convertDateTime pattern="yyyy-MM-dd" />
					</h:outputFormat>
					<br />
					<br />
					<h:dataTable id="idTable" value="#{surveyBeanAnswers.questions}"
						var="question" rendered="#{surveyBeanAnswers.valid()}">
						<h:column>
							<br />
							<h:outputText value="#{question.questionDTO.text}"
								styleClass="answerTitle" />

							<h:selectOneRadio id="radio" value="#{question.selectedItem}"
								converter="javax.faces.Integer"
								rendered="#{question.simple != null}">
								<f:selectItems value="#{question.simple}" var="option"
									itemLabel="#{option.questionOptionDTO.text}"
									itemValue="#{option.questionOptionDTO.id}" />
							</h:selectOneRadio>

							<h:selectManyCheckbox id="check"
								value="#{question.selectedItems}"
								converter="javax.faces.Integer"
								rendered="#{question.multiple != null}">
								<f:selectItems value="#{question.multiple}" var="option"
									itemLabel="#{option.questionOptionDTO.text}"
									itemValue="#{option.questionOptionDTO.id}" />
							</h:selectManyCheckbox>

							<ui:repeat value="#{question.text}" var="option"
								rendered="#{question.text != null}">
								<br />
								<h:outputLabel value="#{option.questionOptionDTO.text}"
									for="text" />
								<br />
								<h:inputTextarea id="text"
									value="#{option.questionOptionDTO.textDefault}" />
								<br />
							</ui:repeat>

							<ui:repeat required="false" value="#{question.rank}" var="option"
								rendered="#{question.rank != null}">
								<h:outputLabel value="#{option.questionOptionDTO.text}"
									for="text" />
								<h:inputText id="rank"
									value="#{option.questionOptionDTO.textDefault}" size="1"
									maxlength="1" converterMessage="Please input a Number!">
									<f:convertNumber integerOnly="true" type="number" />
								</h:inputText>
								<h:message for="rank" style="color:red;font-size:87%" />
							</ui:repeat>

						</h:column>
					</h:dataTable>
					<br />
					<br />
					<h:outputText id="empty" value="#{surveyBeanAnswers.isEmpty}"
						styleClass="inputAreYouSure" />
					<h:commandButton value="Submit" action="#{surveyBeanAnswers.save}"
						rendered="#{surveyBeanAnswers.valid()}"
						styleClass="buttonSurveyAnswer">
						<f:ajax execute="@form" render="@form" />
					</h:commandButton>

					<h:commandButton value="Cancel" action="mySurveys.xhtml"
						styleClass="buttonSurveyAnswer"
						rendered="#{surveyBeanAnswers.valid()}" immediate="true" />

					<h:outputText id="done" value="#{surveyBeanAnswers.done}"
						styleClass="answerTitle" />
					<br />
					<br />
				</h:form>
			</h:panelGroup>
		</h:panelGroup>
	</h:panelGroup>
</h:body>
</html>